package test.y2021;

import cn.hutool.core.lang.Console;
import cn.hutool.json.JSONUtil;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Created By  醉美柳舞之众星捧月
 *
 * @author song
 * @date 2021/11/15 13:33
 */
public class November1 {
    public static void main(String[] args) {
        Console.error(1 << 2);

        /* 缓存 ？ */
        new LinkedHashMap<>();

        /* Monad模式 */
        Optional<Integer> reduce = Stream.of(1, 2, 3, 4, 5, 6).reduce(Math::max);
        Integer integer = reduce.get();
        Console.error(integer);

        Integer reduce1 = Stream.of(1, -2, 3, 4, 5, 6).reduce(0, Math::min);
        Console.error(reduce1);

        Random random = new Random();


/*        List<Integer> collect = IntStream.range(0, 10_000_000).map(i -> random.nextInt(10_000_000)).boxed().collect(Collectors.toList());
        Console.error(collect);*/


        int i = random.nextInt(10_000_000);

        List<Integer> integers = Arrays.asList(new Random().nextInt());

        Console.error(JSONUtil.toJsonStr(integers));


        List<Integer> collect = new Random().ints(0, 10).boxed().collect(Collectors.toList());
        Console.error(JSONUtil.toJsonStr(collect));

    }
}
